package com.softstao.guoyu.mvp.presenter;

import com.softstao.guoyu.model.WechatLogin;
import com.softstao.guoyu.model.me.AgentId;
import com.softstao.guoyu.mvp.interactor.LoginInteractor;
import com.softstao.guoyu.mvp.viewer.BaseViewer;
import com.softstao.guoyu.mvp.viewer.LoginViewer;
import com.softstao.guoyu.mvp.viewer.WechatBindingViewer;

/**
 * Created by vaikus on 2017/6/13.
 */

public class LoginPresenter extends BasePresenter<BaseViewer,LoginInteractor> {
    public void login(String username,String password){
        interactor.login(username,password,o -> ((LoginViewer)viewer).loginResult((AgentId) o));
    }

    public void wechatLogin(String code){
        interactor.wechatLogin(code,o -> ((LoginViewer)viewer).wechatResult((WechatLogin) o));
    }

    public void binding(String mobile,String openid,String password){
        interactor.binding(mobile,openid,password,o -> ((WechatBindingViewer)viewer).bindingResult((WechatLogin) o));
    }
}
